/**
 * Review路由模块
 * routes\reviews.js
 */

var express = require("express");
var router = express.Router();
 
const review = require("../controller/review");
const auth = require("../controller/auth");
 
//定义路由
 
//守卫路由：所有路由必须执行权限控制的判断
router.all("*", auth.isLogin);

router.get("/user", review.findAllByUserId);

router.get('/count', review.getCount);

router.get('/', review.findAll);

router.get('/:id', review.find);

router.post('/', review.add);
 
router.put('/:id', review.update);
 
router.delete('/:id', review.remove);

router.patch('/useful/:id', review.updateUseful);
 
router.patch('/useless/:id', review.updateUseless);

router.get("/user/count", review.getCountByUserId);
 
module.exports = router;
